<template>
  <div>
    <van-row>
      <van-col span="8"> <van-icon name="arrow-left" /> </van-col>
      <van-col span="8">信息中心</van-col>
      <van-col class="col-1" span="8"
        >排序<van-icon name="descending"
      /></van-col>
    </van-row>
    <van-tabs v-model="active" @click="onClick">
      <van-tab title="全部信息"></van-tab>
      <van-tab title="系统信息"></van-tab>
      <van-tab title="个人信息"></van-tab>
    </van-tabs>


  <ul v-for="item in records" :key="item.id" :v-model="active">
      <li class="box-1" >
        <img src="../assets/信息中心/个人信息.png" alt="" />
      </li>
      <li class="box-2">
        <div class="col-21">
          <p>{{item.title}}</p>
          <img src="../assets/信息中心/置顶.png" alt="" />
        </div>
        <p>发布人：{{item.sourceName}}</p>
      </li>
      <li class="box-3" >
        <span>{{item.createTime}}</span><span><van-icon @click="messageclick(item.type,item.id)" name="arrow" /></span>
      </li>
    </ul>


  </div>
</template>

<script>
import { messageData } from "../request/api";
export default {
  data() {
    return {
      active: "0",
      conts: 0,
      records: [],
      
    };
  },
  created() {
    messageData({
      current: "1",
      size: "100",
      type: "0",
    }).then((res) => {
      // console.log(res);
      this.records = res.data.records;
    })
  },
  methods: {
    onClick(val) {
     console.log(val);
     this.conts=val
       messageData({
      current: "1",
      size: "100",
      type: this.conts,
    }).then((res) => {
      // console.log(res);/
      this.records = res.data.records;
    })
    },
    messageclick(val,id){
      console.log(val,id);
      this.$router.push(`messagetypeData?id=${id}`)
    }
  },
};
</script>
 
<style lang = "less" scoped>
.van-row {
  background-color: blue;
  .van-col {
    padding: 20px;
    text-align: center;
    color: #fff;
  }
}
ul{
    display: flex;
    border-bottom:1px solid #ccc ;
    margin-top: 20px;
    padding-bottom: 15px;
     /* height: 60px; */
    .box-1{
        padding: 15px;
        img{
            width: 30px;
            height: 30px;
        }
    }
    .box-2{
      height: 60px;
    .col-21{
    display: flex;
    height: 30px;
    img{
        width: 20px;
        height: 20px;
        margin-top:15px;
    }
    }
    }
    .box-3{
        text-align: right;
        line-height: 35px;
        flex: 1;
        padding-right: 20px;
    }
    
}
</style>